package com.offcn.service;

import com.offcn.dao.UserDao;
import com.offcn.feign.UserFeign;
import com.offcn.pojo.Movie;
import com.offcn.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

@Service
public class UserService {

    @Autowired
    private UserDao userDao;
    
    @Autowired
    private UserFeign userFeign;

    public User getUser(Integer id){
        return userDao.getUser(id);
    }


    public Map<String,Object> buyMovieTicket(Integer id){
        Map<String,Object> map = new HashMap<>();
        //查询用户信息
        User user = userDao.getUser(id);
        map.put("user",user);
        //买电影票
        Movie movie = userFeign.getMovie();
        map.put("movie",movie) ;
        return map;
    }
}
